<%-- 
    Document   : EditProfile
    Created on : Nov 23, 2012, 10:20:25 AM
    Author     : vupttse
--%>


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Edit Profile</title>
        <link href="css/modern.css" rel="stylesheet">
        <link href="css/modern-responsive.css" rel="stylesheet">
        <link href="css/site.css" rel="stylesheet" type="text/css">

        <script src="js/jquery-1.8.2.min.js"></script>
        <script src="js/google-analytics.js"></script>
        <script src="js/github.info.js"></script>
        <script src="js/sharrre/jquery.sharrre-1.3.4.min.js"></script>
        <script src="js/carousel.js"></script>
        <script src="js/dropdown.js"></script>
        <script src="js/slider.js"></script>
        <script src="js/hover.js"></script>
        <script src="js/pagecontrol.js"></script>
        <script src="js/accordion.js"></script>
        <script>
            //            Validate the input of the form when submit
            function validateForm()
            {
                var x=document.forms["EditProfileForm"]["username"].value;
                var y=document.forms["EditProfileForm"]["fullName"].value;
                if (x==null || x=="" || y==null || y=="")
                {
                    alert("Please enter fullname!");
                    return false;
                }
            }
        </script>
    </head>
    <body>
        <%
            UserEntity entity = (UserEntity) session.getAttribute("currentUser");
            if (entity != null) {

        %>
        <div class="page">            
            <jsp:include page="Navigation.jsp"></jsp:include>
                <div class="page-region">
                    <div class="page-region-content" style="min-height: 500px">
                        <div class="span8" style="margin-left: 20px">
                            <h1>Editing Profile</h1>
                            <form name="EditProfileForm" action="EditingProfile.jsp" method="get" onsubmit="return validateForm()">
                                <table>                              
                                    <tr>
                                        <td>Gender</td>
                                        <td>
                                            <label class="radiobox">
                                                <input type="radio" name="gender" value="Male" checked="<%=entity.getGender().trim().equals("Male")%>">
                                            <span>Male</span>   
                                        </label>
                                        <label class="radiobox">
                                            <input type="radio" name="gender" value="Female" checked="<%=entity.getGender().trim().equals("Female")%>">
                                            <span>Female</span>                                                                                                   
                                        </label>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Full Name</td>
                                    <td><input type="text" name="fullName" value="<%=entity.getFullName().trim()%>"></td>
                                </tr>
                                <tr>
                                    <td>Telephone Number</td>
                                    <td><input type="text" name="tel" value="<%=entity.getTel().trim()%>"></td>
                                </tr>
                                <tr>
                                    <td>Address</td>
                                    <td><input type="text" name="address" value="<%=entity.getAddress().trim()%>"></td>
                                </tr>
                                <tr>
                                    <td>Nationality</td>
                                    <td><input type="text" name="nationality" value="<%=entity.getNationality().trim()%>"></td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td><input type="submit" value="Update">
                                        <input type="reset" value="Default"></td>
                                </tr>
                            </table>
                        </form>
                    </div>
                </div>
            </div>
            <%@include  file="footer.html" %>
        </div>
        <%} else {
                response.sendRedirect("LoginPage.jsp");
            }
        %>
    </body>
</html>
